;; 最小化容器模板



(use-modules
 (gnu)
 (gnu packages)
 (gnu packages busybox)
 (gnu packages bash)
 (gnu services base)
 (gnu services ssh)
 )


(operating-system
  (host-name "minetest")
  (timezone "UTC")
  (locale "en_US.utf8")

  
  ;; 引导(忽略)
  (bootloader (bootloader-configuration
	       (bootloader grub-bootloader)
	       (target "does-not-matter")))
  
  ;; 文件系统(忽略)
  (file-systems (list (file-system
			(device "does-not-matter")
			(mount-point "/")
			(type "does-not-matter"))))


  ;; 账户
  (users
   (append
    (list
     (user-account
      (name "minetest")
      (comment "user")
      (group "users")
      (uid 43929))
     )
    %base-user-accounts))
 
  ;; 全局安装的包
  (packages
   (map
    specification->package
    (list
     ;; shell
     "bash"
     
     ;; 工具集
     "busybox"

     ;; 终端复用器
     "tmux"

     ;; 游戏服务器
     "minetest"

     ;; 编辑器
     "vim"

     ;; 归档
     "tar"

     ;; 压缩
     "gzip"
     "xz"
     "bzip2"
     "unzip"

     ;; ssl证书
     "nss-certs"
     )
    )
   )

  ;; 服务
  (services
   (list
    ;; 脚本兼容
    (service special-files-service-type
	     `(("/bin/sh" ,(file-append bash "/bin/sh"))
	       ("/usr/bin/env" ,(file-append coreutils "/bin/env"))))

    ;; ssh
    (service openssh-service-type
	     (openssh-configuration
	      (port-number 49923)
	      (permit-root-login #f)
	      (password-authentication? #f)
	      (public-key-authentication? #t)))
    
    ;; log 记录服务
    (syslog-service)

    ;; 网络
    (service static-networking-service-type
	     (list (static-networking (interface "lo")
				      (ip "127.0.0.1")
				      (requirement '())
				      (provision '(loopback)))))
    
    )
   )
  )
